#ifndef AUTOMOBILE_H
#define AUTOMOBILE_H

#include <list>
#include "Object.h"
#include "IDisplay.h"

//! Represents an Automobile.
/*!
	The class Automobile represents an automobile.
	Acts as Base class for vehicles and implements the
	Subject functionality (Attach, detach, notify) and
	also manages a list of Observers (Display).
	In terms of design patterns (Subject Observer) it's
	a Subject.
	\class Automobile
	\author Thomas Pfeiffer
	\date 13.11.2012
*/
class Automobile : public Object {
public:
	//! Adds a Display (Observer) to the list of observers.
	/*!
	The function Attach adds the Display (Observer) obs to
	the list of observers. obs's Update function will be called
	when Notify is called.
	\param obs A Pointer to a Display which should be updated in
	  case of a notify.
	*/
	void Attach(IDisplay* obs);

	//! Removes obs from the list of observers.
	/*!
	The function Detach removes the Display obs from the list
	of observers. obs will not be updated in case of a notify any
	more.
	\param obs A Pointer to a Display which should be removed from
	the list of the observers.
	*/
	void Detach(IDisplay* obs);

protected:
	//! Updates all observers.
	/*!
	The function notify is called if the Data of the concrete
	subject changed. Calls update on all observers in the list.
	*/
	void Notify() const;

	//! An Iterator for the observers list.
	typedef std::list<IDisplay*>::iterator TObserversIterator;
	//! A constant Iterator for the observers list.
	typedef std::list<IDisplay*>::const_iterator TObserversConstIterator;

private:
	std::list<IDisplay*> mObservers;

};

#endif